
cc.Class({
    extends: cc.Component,

    properties: {
        innerNumber: 0,

        IsPutDown: true,
        collistion: null,
        id: 0,

        zxzx: 0,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {
        this.IsPutDown = true;
        this.collistion = null;

        this.collistionArrayI = 0;
        this.collistionArrayJ = 0;

        let _color;
        for (let i = 0; i < cellColor.length; i++) {
            if (this.innerNumber == cellColor[i].num) {
                _color = cellColor[i].color;
            }
        }
        this.node.color = cc.color(_color);
        // console.log(this.color);

        let _subNumber = cc.find("zz", this.node);//数字
        _subNumber.getComponent(cc.Label).string = this.innerNumber;

    },

    //第一次碰撞
    onCollisionEnter: function (other, self) {
        this.collistion = other.node;
        this.aa = this.collistion.getComponent('cell');

        this.collistionArrayI = this.aa.arrayI;
        this.collistionArrayJ = this.aa.arrayJ;
        this.id = this.aa.id;

        if (this.aa.IsSurePut) {
            putDownNumber += 1;
        }

    },
    //持续碰撞
    onCollisionStay: function (other, self) {

    },
    //离开碰撞
    onCollisionExit: function (other, self) {
        if (this.aa.IsSurePut) {
            if (putDownNumber != 0)
                putDownNumber -= 1;
        }
        this.collistion = null;
    },


    // update (dt) {},
});
